
		<div class="easyui-layout" data-options="fit:true">
			<table id="targetStatisticTable" class="easyui-datagrid" style="height:100%;">
				<thead>
						<tr>
							<th data-options="field:'jd',width:100,align:'center'">阶段</th>
							<th data-options="field:'pq',width:100,align:'center'">排期</th>
							<th data-options="field:'starttime',width:100,align:'center'">开始时间</th>
							<th data-options="field:'endtime',width:100,align:'center'">结束时间</th>
							<th data-options="field:'plannum',width:100,align:'center'">计划次数</th>
							<th data-options="field:'realplannum',width:100,align:'center'">实际次数</th>
							<th data-options="field:'plandiff',width:100,align:'center'" formatter='format_plandiff'>差距</th>
							<th data-options="field:'target',width:100,align:'center'">目标减重</th>
							<th data-options="field:'realtarget',width:100,align:'center'">实际减重</th>
							<th data-options="field:'targetdiff',width:100,align:'center'" formatter='format_targetdiff'>差距</th>
						</tr>
					</thead>
			</table>
		</div>
		<script type="text/javascript">
			$(document).ready(function () {
				//加载数据表格
				loadTargetStatisticTable();
			});
			
			function  loadTargetStatisticTable() {	
				$('#targetStatisticTable').datagrid({
					cls: "theme-datagrid",
					singleSelect: true,
					url: "${cxt!}/customerInfoStatistic/customerTargetStatistic",
					queryParams: {
						'customerIds': '${customerIds! }'
					},
				    method: 'post',
					collapsible: true,
					onLoadSuccess:function(){
						var rows = $('#targetStatisticTable').datagrid('getRows');
						if(rows.length > 0){
							$('#targetStatisticTable').datagrid('mergeCells',{
								index: rows.length - 1,
								field: 'jd',
								colspan: 2
							});
							var merges = new Array();
							var index = 0;
							for(var i = 0; i < rows.length; i++){
								if(rows[i]['pq'] == '汇总'){
									var rs = (i+1-index);
									merges.push({
										index:index,
										rowspan:rs
									});
									index = i+1;
								}
				            }
							for(var i=0; i<merges.length; i++){
								$('#targetStatisticTable').datagrid('mergeCells',{
									index:merges[i].index,
									field:'jd',
									rowspan:merges[i].rowspan
								});
							}
						}
					}
				})
			}
			
			//指定列求累计
	        function partSize_diff(colName) {
	             var rows = $('#targetStatisticTable').datagrid('getRows');
	             var diff = 0;
	             var length = rows.length;
	             var before = parseFloat(rows[0][colName]);
	             var after = parseFloat(rows[length-1][colName]);
	             diff = (before - after).toFixed(1);
	             return diff;
	        }
			
			//计划次数求差
			function format_plandiff(value,row){
				return row.plannum - row.realplannum;
			}
			
			//目标求差
			function format_targetdiff(value,row){
				return row.target - row.realtarget;
			}
			
		</script>
